package com.jixiaotian.spring.annotation.demo.annotation.lifecycle;

import com.jixiaotian.spring.annotation.demo.annotation.componentscan.MyTypeFilter;
import com.jixiaotian.spring.annotation.project.entity.Car;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FilterType;

/**
 * @Author: jixiaotian.ch@qq.com
 * @Date : 2020/9/10
 */
@Configuration
public class MyConfig {

    //对Bean生命周期的监控
    //1、配置@Bean的参数
    //2、分别实现InitializingBean和DisposableBean接口
    @Bean(initMethod = "addOil", destroyMethod = "close")
    public Car car() {
        System.out.println("将对象添加到IoC容器中");
        return new Car();
    }



}
